!macro preInit
  # 不写死安装路径，保持默认由 Electron Builder 控制（即 ${user_selected_directory}\${productName}）
!macroend

!macro postInstall
  # 将最终安装目录写入注册表
  WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "$INSTDIR"
!macroend

!macro postUninstall
  # 卸载时清理注册表
  DeleteRegValue HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation
!macroend